import Vue from "vue";
import ElementUI from "element-ui";
import router from "./router/index.js";
import "element-ui/lib/theme-chalk/index.css";
import App from "./App.vue";
import AjaxPlugin from "./utils/ajax/index.js";
import store from "./store/index.js";
import '@fortawesome/fontawesome-free/css/all.css'

Vue.use(ElementUI);
Vue.use(AjaxPlugin);

const bus = new Vue();

Object.defineProperties(Vue.prototype, {
  $bus: {
    get: function () {
      return bus;
    }
  }
});

router.beforeEach((to, from, next) => {
  if (to.path === "./index") {
    router.push("/specia");
  } else {
    next();
  }
});
// 权限控制
new Vue({
  data() {
    return {
      eventBus: new Vue(),
    };
  },
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
